package com.igbeok.miscellaneous.concurrency.hemberg2;

public class Pool {

	private Hemberg[] pool = new Hemberg[9];
	private int index = 0;

	public void push(Hemberg hemberg) {
		if (index < pool.length) {
			pool[index++] = new Hemberg();
		} 
	}

	public  Hemberg pop() {
		if (index >= 0) {
			return pool[index--];
		} else {
			return null;
		}
	}

	public  boolean isFull() {
		return index == pool.length - 1;
	}
}
